package com.jielihaofeng.cachekit;

import java.io.Serializable;
import java.util.EventObject;

/**
 * @author Johnnie Wind
 * @description 方法的参数和方法包装为事件
 * @date 2021/10/25 11:34
 */
public class Event<T> extends EventObject implements Serializable {

    private static final long serialVersionUID = 1L;

    private EventType eventType = EventType.PRINT;

    public Event(T param,EventType type) {
        // param 表示函数的参数
        super(param);
        this.eventType = type;
    }

    public EventType getEventType(){
        return eventType;
    }

    @SuppressWarnings("unchecked")
    public T getParam(){
        return (T)super.getSource();
    }

}
